{include file="public/head"/}

<div class="silde">
<script language="javascript">
	$(document).ready(function () {
		//设置modal垂直居中,移动
		modalSetting(".modal"); 
	});
</script>
<div  id="main">
	<div class="container-fluid">
		<input type="hidden" id="sale_id" value="{$id|default=0}">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<div class="alert alert-dismissable alert-info">
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
					<h4> 信息框 </h4>
					包销单，没有配货TAB。<br>
					送货单，没有费用/付款/送货单TAB。<br>
					包销订单的产品列表中。多一列“已送/未送”，统计他的送货单下的产品送货情况。<br>
				</div>
			</div>
		</div>
	   
		<div class="ntDesktop">
		  	<div class="ntDesktop-head">销售订单 ({{formatUnit(sale_id,'id')}}) 详情</div>

				<div class="row" style="padding-top:0px">
					<div class="col-md-10">
						<ul class="nav nav-tabs">
							<li class="active">
								<a href="#sale" data-toggle="tab">订单</a>
							</li>
							<li>
								<a href="#products" data-toggle="tab">
									产品 <span class="label label-info">{{proNum ? proNum : ''}}</span>
								</a>
							</li>
							<li>
								<a href="#cost" data-toggle="tab">
									费用  <span class="label label-info">{{proNum ? proNum : ''}}</span>
								</a>
							</li>
							<li>
								<a href="#pay" data-toggle="tab">付款安排</a>
							</li>
							<li>
								<a href="#paid" data-toggle="tab">付款登记</a>
							</li>
							<li v-if="saleList.underwrite == 1">
								<a href="#delivery" data-toggle="tab" >送货单</a>
							</li>
							<li v-if="saleList.underwrite == 0">
								<a href="#making" data-toggle="tab">配货</a>
							</li>
							<li>
								<a href="#log" data-toggle="tab">订单记录</a>
							</li>
						</ul>
					</div>
					<div class="col-md-2 text-right">
						<a :href="'/admin/sale/list'" class="btn btn-default" style="width:10em">
							<span class="fa fa-arrow-left"> 返回列表</span>
						</a>
					</div>
				</div>

				<div class="tab-content" style="padding-top: 1em">
					<!-- 订单 -->
					<div class="tab-pane active" id="sale">
						<div class="row">
							<div class="col-md-8">
								<div class="panel panel-default">
									<div class="panel-body">
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">订单号</div>
											<div class="col-md-1">{{ formatUnit(saleList.id,'id') }}</div>
											<div class="col-md-5">
												<span class="label label-warning">{{saleList.priority}}</span>
												<span class="label label-primary" v-if="saleList.underwrite == 1">UW</span>
												<span class="label label-warning" v-if="saleList.pledge == 1">PLEDGE</span>
												<span class="label label-warning" v-if="saleList.makefirst == 1">FM</span>
											</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">客户</div>
											<div class="col-md-11">
												{{saleList.company_name}}
											</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">信用</div>
											<div class="col-md-11">

												积分：20000 / 等级：10  (数据来源？)
											</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">分公司</div>
											<div class="col-md-11 ">
												<div class="label label-info">{{saleList.branchcompany_name ? saleList.branchcompany_name : '-'}}</div>
											</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">地址</div>
											<div class="col-md-11 ">
												{{saleList.address ? saleList.address : '-'}}
											</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">业务员</div>
											<div class="col-md-11">{{saleList.saler_name}}</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">发票</div>
											<div class="col-md-11">
												{{saleList.sale_invoice_no ? saleList.sale_invoice_no : '-'}}<br>
												<template v-if="saleList.sale_invoice_no">
													{{ saleList.sale_invoice_type + ' / ' + saleList.drawer_name + ' / ' + saleList.drawer_time }}
													<!-- TT / JACICKA / 20-02-2020 11:22:33 -->
												</template>
												<template v-else> - </template>
											</div>
										</div>

										<div class="row" style="padding:0.4em">
											<div class="col-md-1">送货方式</div>
											<div class="col-md-11">{{saleList.delivery_type_name}}</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">指定物流</div>
											<div class="col-md-11">{{saleList.trans_name ? saleList.trans_name : '-'}}</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">建立</div>
											<div class="col-md-11">{{saleList.create_name + ' / ' + saleList.create_time}}</div>
										</div>
										<div class="row" style="padding:0.4em">
											<div class="col-md-1">编辑</div>
											<div class="col-md-11">{{saleList.update_name + (saleList.update_time ? ' / ' + saleList.update_time : '')}}</div>
										</div>
									</div>
								</div>
							</div>
							<div class="col-md-4">
								<div class="panel panel-info">
									<div class="panel-heading">订单备注</div>
									<div class="panel-body">
										<template v-if="saleOrderRemarkData != undefined && saleOrderRemarkData.length > 0">
											<ul v-for="(saleOrderRemarkDataItem,saleOrderRemarkDataIndex) in saleOrderRemarkData">
												<li><span class="label label-info" v-if="saleOrderRemarkDataItem.private == 1">P</span> {{saleOrderRemarkDataItem.content}}</li>
											</ul>	
										</template>
										<template v-else>
											<ul style="text-align: center;" >
				                                <li style="font-weight:800;font-size: 24px">{:lang('no_data')} </li>
				                            </ul>
										</template>
									</div>
								</div>
							</div>
							
						</div>
					</div>

					<!-- 产品 -->
					<div class="tab-pane" id="products">
						<div class="row">
							<div class="col-md-12">
								<div class="panel panel-default">
									<table class="table table-striped table-hover">
										<thead>
											<tr>
												<th>No.</th>
												<th>产品</th>
												<th>箱规</th>
												<th>库存</th>
												<th>数量</th>
												<th v-if="saleList.underwrite == 1">已送/未送</th>
												<th>单价</th>
												<th>小计</th>
												<th>折扣</th>
												<th>提成</th>
												<th>备注</th>
											</tr>
										</thead>
										<tbody>
											<tr v-for="(orderListItem,orderListIndex) in orderList">
												<td align="center">{{orderListIndex+1}}</td>
												<td>
													<div class="pro">
														<div class="pro-icon"><img :src="orderListItem.img_url" border="0" width="48px" height="48px" alt="ICON"></div>
														<div class="pro-name">
															<small>{{formatUnit(orderListItem.prochar_id,'id') + (orderListItem.brand_name ? ' / ' + orderListItem.brand_name : '') + (orderListItem.model ? ' / ' + orderListItem.model : '') }}</small> <br />{{orderListItem.pro_name}}
														</div>
													</div>
												</td>
												<td align="right">
													{{orderListItem.prochar_qty}}<small class="unit">PCS/CTN</small><br>
													{{orderListItem.ctn_size}}<small class="unit">CM</small>
												</td>

												<!-- <td align="right"><span class="blue">大量</span></td>
												<td align="right"><span class="red">少量</span></td> -->

												<td align="right">
													<span class="red" v-if="orderListItem.status.status <= 2 ">{{ formatUnit(orderListItem.status.status,'PCS')}}</span> <small class="unit" v-if="orderListItem.status <= 2 ">PCS</small></span>
													<span class="red" v-if="orderListItem.status.status == 9">少量</span>
													<span class="blue" v-if="orderListItem.status.status == 8">大量</span>
													<span class="green" v-if="orderListItem.status.status == 7">充足</span>
													<br>
													<span class="label label-info" v-if="orderListItem.storeType == 'outGet'">外调</span>
													<span class="label label-danger" v-if="orderListItem.storeType == 'futures'">期货</span>
												</td>

												<td align="right">{{ formatUnit(orderListItem.qty,'PCS') }}<small class="unit">PCS</small></td>

												<td align="right" v-if="saleList.underwrite == 1">
													{{ formatUnit((orderListItem.qty-orderListItem.undone_qty),'PCS') }}<small class="unit">PCS</small><br>
													{{ formatUnit(orderListItem.undone_qty,'PCS') }}<small class="unit">PCS</small>
												</td>
												<td align="right">{{ formatUnit(orderListItem.price,'BRL') }}<small class="unit">BRL</small></td>
												<td align="right">{{ formatUnit((orderListItem.qty*orderListItem.price),'BRL') }}<small class="unit">BRL</small></td>
												<td align="right">{{ formatUnit(orderListItem.orderListDiscount,'%') }}<small class="unit">%</small></td>
												<td align="right">{{ formatUnit(orderListItem.orderListCommission,'%') }}<small class="unit">%</small></td>
												<td></td>
											</tr>
										</tbody>
									</table>
								</div>
								
							</div>
						</div>
					</div>
				
					<!-- 费用 -->
					<div class="tab-pane" id="cost" >
						<div class="row">
							<div class="col-md-3">
								<div class="panel panel-info">
									<div class="panel-heading">账单</div>
									<div class="panel-body">
										<table class="table ntTable">
											<tbody>
												<tr >
													<td>货款</td>
													<td align="right"> {{ formatUnit(billData.SumProPrice,'BRL') }} <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>折扣</td>
													<td align="right"> <span class="red">{{ formatUnit(billData.SumDiscountPrice,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>提成</td>
													<td align="right"> <span class="green">{{ formatUnit(billData.SumCommissionPrice,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>费用 <span class="label label-primary">合计</span></td>
													<td align="right"> <span class="blue">{{ formatUnit(billData.sumCost,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>应付</td>
													<td align="right"> {{ formatUnit(billData.mustPay,'BRL') }}<small class="unit">BRL</small></td>
												</tr>
											</tbody>
										</table>
									</div>
								</div>
							</div>
							<div class="col-md-9">
								<div class="panel panel-default">
									<div class="panel-heading">
										订单费用
									</div>
									<table class="table table-hover">
										<thead>
											<tr>
												<th>No.</th>
												<th>类型</th>
												<th>备注</th>
												<th>金额</th>
												<th>编辑</th>
											</tr>
										</thead>
										<tbody>
											<tr v-for="(costDataItem,costDataIndex) in costData">
												<td align="center">{{costDataIndex+1}}</td>
												<td>{{costDataItem.content}}</td>
												<td>{{costDataItem.costRemarks}}</td>
												<td align="right">
													<span class="blue" v-if="costDataItem.options != '='">{{ costDataItem.options + ' '+ formatUnit(costDataItem.amount,'$')  }}</span>
													<span class="green" v-else>{{formatUnit(costDataItem.amount,'$')}}</span>
													<small class="unit">BRL</small>
												</td>
												<td> {{costDataItem.create_name + costDataItem.create_at}}</td>
											</tr>
										</tbody>
									</table>
								</div>
								
							</div>
						</div>
					</div>
					
					<!-- 付款安排 -->
					<div class="tab-pane" id="pay">
						<div class="row">
							<div class="col-md-3">
								<div class="panel panel-info">
									<div class="panel-heading">账单</div>
									<div class="panel-body">
										<table class="table ntTable">
											<tbody>
												<tr >
													<td>货款</td>
													<td align="right"> {{ formatUnit(billData.SumProPrice,'BRL') }} <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>折扣</td>
													<td align="right"> <span class="red">{{ formatUnit(billData.SumDiscountPrice,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>提成</td>
													<td align="right"> <span class="green">{{ formatUnit(billData.SumCommissionPrice,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>费用 <span class="label label-primary">合计</span></td>
													<td align="right"> <span class="blue">{{ formatUnit(billData.sumCost,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>应付</td>
													<td align="right"> {{ formatUnit(billData.mustPay,'BRL') }}<small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>安排 <span class="label label-primary">合计</span></td>
													<td align="right"> {{formatUnit(billData.payment,'BRL')}} <small class="unit">BRL</small></td>
												</tr>
											</tbody>
										</table>
									</div>
								</div>
							</div>
							<div class="col-md-9">
								<div class="panel panel-default">
									<div class="panel-heading">付款安排</div>
									
									<table class="table table-hover">
										<thead>
											<tr>
												<th>No.</th>
												<th>支付方式</th>
												<th>日期</th>
												<th>金额</th>
												<th>百份比</th>
												<th>编辑</th>
											</tr>
										</thead>
										<tbody>
											<tr  v-for="(paymentListItem,paymentListIndex) in paymentList">
												<td align="center">1</td>
												<td>{{ paymentListItem.content }}</td>
												<td>{{ paymentListItem.paymentDay }}</td>
												<td align="right"> {{ formatUnit(paymentListItem.amount,'BRL') }}<small class="unit">BRL</small></td>
												<td align="right"> {{ formatUnit(paymentListItem.paymentPercentage,'%') }}<small class="unit">%</small></td>
												<td> {{ paymentListItem.create_name }} <br> <small> {{ paymentListItem.create_at }}</small></td>
											</tr>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="6" align="right"> 合计金额: {{formatUnit(billData.payment,'BRL')}}<small class="unit">BRL</small></td>
											</tr>
										</tfoot>
									</table>
								</div>
							</div>
						</div>
					</div>
					
					<!-- 付款登记 -->
					<div class="tab-pane" id="paid">
						<div class="row">
							<div class="col-md-3">
								<div class="panel panel-info">
									<div class="panel-heading">账单</div>
									<div class="panel-body">
										<table class="table ntTable">
											<tbody>
												<tr >
													<td>货款</td>
													<td align="right"> {{ formatUnit(billData.SumProPrice,'BRL') }} <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>折扣</td>
													<td align="right"> <span class="red">{{ formatUnit(billData.SumDiscountPrice,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>提成</td>
													<td align="right"> <span class="green">{{ formatUnit(billData.SumCommissionPrice,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>费用 <span class="label label-primary">合计</span></td>
													<td align="right"> <span class="blue">{{ formatUnit(billData.sumCost,'BRL') }}</span> <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>应付</td>
													<td align="right"> {{ formatUnit(billData.mustPay,'BRL') }}<small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>已付 <span class="label label-primary">已确认</span></td>
													<td align="right"> {{ formatUnit(billData.sumPaid,'BRL') }} <small class="unit">BRL</small></td>
												</tr>
												<tr>
													<td>未付</td>
													<td align="right"> {{ formatUnit((billData.mustPay - billData.sumPaid),'BRL') }} <small class="unit">BRL</small></td>
												</tr>
											</tbody>
										</table>
									</div>
								</div>
							</div>
							<div class="col-md-9">
								<div class="panel panel-default">
									<div class="panel-heading">支付记录</div>
									
									<table class="table table-hover">
										<thead>
											<tr>
												<th>No.</th>
												<th>登记</th>
												<th>单号</th>
												<th>支付类型</th>
												<th>支付日期</th>
												<th>收款账号</th>
												<th>金额</th>
												<!-- <th>登记</th> -->
												<th>确认</th>
												<th>状态</th>
											</tr>
										</thead>
										<tbody>
											<template v-if="payregList != undefined && payregList.length > 0">
												<tr  v-for="(payregListItem,payregListIndex) in payregList">
													<td align="center">{{payregListIndex+1}}</td>
													<td>{{payregListItem.create_name}} <br> <small> {{payregListItem.create_at}}</small></td>
													<td>{{formatUnit(payregListItem.sale_id,'id')}}</td>

													<td>
														<template v-if="payregListItem.paytype_id != 3 && payregListItem.paytype_id != 4 && payregListItem.paytype_id != 5 && payregListItem.paytype_id != 6">{{payregListItem.paytype_name}}</template>

														<!-- 现金支票/期票 -->
														<template v-if="payregListItem.paytype_id == 3 || payregListItem.paytype_id == 4">
															<button class="btn btn-sm btn-default" data-toggle="popover" title="支票信息" @mouseover="setpopper">
																支票
																<div class="content" style="display: none;">
																	<div style="width:30vw">
																		<table class="table">
																			<tbody>
																				<tr>
																					<td width="25%">开票银行</td>
																					<td>{{payregListItem.payregDetail[0].bank_name}}</td>
																				</tr>
																				<tr>
																					<td>支票号</td>
																					<td>{{payregListItem.payregDetail[0].number}} </td>
																				</tr>
																				<tr>
																					<td>支票署名</td>
																					<td>{{payregListItem.payregDetail[0].signature}}</td>
																				</tr>
																				<tr>
																					<td>付款日期</td>
																					<td>{{payregListItem.payregDetail[0].chequeDay}}</td>
																				</tr>
																				<tr>
																					<td>获得</td>
																					<td>
																						{{payregListItem.payregDetail[0].got_name + ( payregListItem.payregDetail[0].got_time ? ' / ' + payregListItem.payregDetail[0].got_time : '' )}}
																					</td>
																				</tr>
																				<!-- <tr>
																					<td>存入</td>
																					<td>
																						建设银行账号 / 88 *** 8888<br>
																						NEXT TRADING COMPANY<br>
																						22-02-2020
																					</td>
																				</tr> -->
																				<tr>
																					<td>使用</td>
																					<td>
																						{{payregListItem.payregDetail[0].remark}}
																					</td>
																				</tr>
																				<tr>
																					<td>确认</td>
																					<td>
																						{{payregListItem.payregDetail[0].checkName + ( payregListItem.payregDetail[0].checkTime ? ' / ' + payregListItem.payregDetail[0].checkTime : '' )}}
																					</td>
																				</tr>
																			</tbody>
																		</table>
																	</div>
																</div>
															</button>
														</template>

														<!-- 转账 -->
														<template v-if="payregListItem.paytype_id == 5">
															<button class="btn btn-sm btn-default" data-toggle="popover" title="转账信息"  @mouseover="setpopper">
																转账
																<div class="content" style="display: none;">
																	<div style="width:30vw">
																		<table class="table">
																			<tbody>
																				<tr>
																					<td width="25%">汇出账号</td>
																					<td v-if="payregListItem.payregDetail[0].transferOutId > 0 ">
																						{{payregListItem.payregDetail[0].transferOutBrankName + ' / ' + payregListItem.payregDetail[0].transferOutName}}<br>
																						{{payregListItem.payregDetail[0].transferOutAccountName}}
																					</td>
																					<td v-else>-</td>
																				</tr>
																				<tr>
																					<td>流水号</td>
																					<td>{{payregListItem.payregDetail[0].transferNo}} </td>
																				</tr>
																				<tr>
																					<td>存入账号</td>
																					<td>
																						{{payregListItem.payregDetail[0].transferInBrankName + ' / ' + payregListItem.payregDetail[0].transferInName}}<br>
																						{{payregListItem.payregDetail[0].transferInAccountName}}
																					</td>
																				</tr>
																				<tr>
																					<td>确认</td>
																					<td >
																						{{payregListItem.payregDetail[0].checkName +  (payregListItem.payregDetail[0].checkTime ? ' / ' + payregListItem.payregDetail[0].checkTime : '') }} 
																					</td>
																				</tr>
																			</tbody>
																		</table>
																	</div>
																</div>
															</button>
														</template>

														<!-- 银行单 -->
														<template v-if="payregListItem.paytype_id == 6">
															<button class="btn btn-sm btn-default" data-toggle="popover" title="银行单信息" @mouseover="setpopper">
																银行单
																<div class="content" style="display: none;">
																	<div style="width:30vw">
																		<table class="table">
																			<tbody>
																				<tr>
																					<td>银行单号</td>
																					<td>{{payregListItem.payregDetail[0].number}} </td>
																				</tr>
																				<tr>
																					<td>存入账号</td>
																					<td v-if="payregListItem.payregDetail[0].account_id > 0 ">
																						{{ payregListItem.payregDetail[0].brankName + ' / ' + payregListItem.payregDetail[0].accountNum }}<br>
																						{{payregListItem.payregDetail[0].accountName}} 
																					</td>
																					<td v-else>-</td>
																				</tr>
																				<tr>
																					<td>开单</td>
																					<td>
																						{{payregListItem.payregDetail[0].create_name + (payregListItem.payregDetail[0].create_time ? ' / ' + payregListItem.payregDetail[0].create_time :'')}}
																					</td>
																				</tr>
																				<tr>
																					<td>存入日期</td>
																					<td>
																						{{payregListItem.payregDetail[0].pay_day}}
																					</td>
																				</tr>
																				<tr>
																					<td>确认</td>
																					<td>
																						{{payregListItem.payregDetail[0].check_name + (payregListItem.payregDetail[0].check_time ? ' / ' + payregListItem.payregDetail[0].check_time :'')}}
																					</td>
																				</tr>
																			</tbody>
																		</table>
																	</div>
																</div>
															</button>
														</template>
													</td>

													<td>{{payregListItem.pay_day}}</td>
													<td>
														<template v-if="payregListItem.paytype_id != 3 && payregListItem.paytype_id != 4 && payregListItem.paytype_id != 5 && payregListItem.paytype_id != 6"></template>
														<template v-if="payregListItem.paytype_id == 3 || payregListItem.paytype_id == 4"></template>
														<template v-if="payregListItem.paytype_id == 5">
															{{payregListItem.payregDetail[0].transferInBrankName + ' / ' + payregListItem.payregDetail[0].transferInName}}<br>
															{{payregListItem.payregDetail[0].transferInAccountName}}
														</template>
														<template v-if="payregListItem.paytype_id == 6">
															{{ payregListItem.payregDetail[0].brankName + ' / ' + payregListItem.payregDetail[0].accountNum }}<br>
															{{payregListItem.payregDetail[0].accountName}}
														</template>
													</td>
													<td align="right"> {{ formatUnit(payregListItem.amount,'BRL') }}<small class="unit">BRL</small></td>
													<!-- <td> SMITH <br> <small> 25-12-2019 15:30:30</small></td> -->
													<td> {{payregListItem.check_name ? payregListItem.check_name : '-'}} <br> <small>{{payregListItem.check_time}}</small></td>
													<td> 
														<span class="text-success" v-if="payregListItem.status == 1">完成</span> 
														<span class="text-danger" v-if="payregListItem.status == 2">失败</span>
														<span class="text-primary" v-if="payregListItem.status == 3">收到</span>
														<span class="text-warning" v-if="payregListItem.status == 4">确认中</span>
													</td>
												</tr>	
											</template>
											<template v-else>
												<tr style="text-align: center;" >
					                                <td colspan="9" class="no_date" style="line-height: 10rem">{:lang('no_data')} </td>
					                            </tr>
											</template>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="10" align="right">
													登记金额合计: {{ formatUnit(paymentAmount,'BRL') }}<small class="unit"></small> / 
													已付: {{ formatUnit(billData.sumPaid,'BRL') }}<small class="unit">BRL</small> / 
													未付: {{ formatUnit((paymentAmount-billData.sumPaid),'BRL') }}<small class="unit">BRL</small>
												</td>
											</tr>
										</tfoot>
									</table>
									
								</div>
							</div>
						</div>
					</div>
				
					<!-- 送货单 -->
					<div class="tab-pane" id="delivery" >
						<div class="row">
							<div class="col-md-12">
								<div class="panel panel-default">
									<table class="table table-hover table-striped">
										<thead>
											<tr>
												<th>#</th>
												<th width="25%">公司</th>
												<th>产品</th>
												<th>箱规</th>
												<th>数量</th>
												<th>编辑</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
											<template v-for="(deliveryNoteListItem,deliveryNoteListIndex) in deliveryNoteList" v-if="deliveryNoteList.length > 0">
												<tr v-for="(detailItem,detailIndex) in deliveryNoteListItem.detail">
													<template v-if="detailIndex == 0">
														<td><a href="sale.detail.php">{{formatUnit(detailItem.sale_id,'id')}}</a></td>
														<td>
															<a href="company.detail.php">{{deliveryNoteListItem.company_name}}</a><br>
															<span class="label label-info" v-if="deliveryNoteListItem.branch_name">分公司{{deliveryNoteListItem.branch_name}}</span>
														</td>
													</template>
													<template v-else>
														<td></td>
														<td></td>
													</template>
													<td>
														<div class="pro">
															<div class="pro-icon"><img :src="detailItem.proInfo.img_url" border="0" width="48px" height="48px" alt="ICON"></div>
															<div class="pro-name">
																<small>{{ formatUnit(detailItem.proInfo.prochar_id,'id') + (detailItem.proInfo.brand_name ? ' / ' + detailItem.proInfo.brand_name : '') + (detailItem.proInfo.model ? ' / ' + detailItem.proInfo.model : '') }}</small> <br />{{detailItem.proInfo.pro_name}}
															</div>
														</div>
													</td>
													<td align="right">
														{{ formatUnit(detailItem.proInfo.prochar_qty,'PCS')}}<small class="unit">PCS/CTN</small><br>
														{{detailItem.proInfo.ctn_size}}<small class="unit">CM</small>
													</td>
													<td align="right">{{detailItem.ty}}<small class="unit">PCS</small></td>
													<td>{{detailItem.create_name}}<br>{{detailItem.create_time}}</td>
													<template v-if="detailIndex == 0">
														<td align="right">
															<button class="btn btn-sm btn-default" data-toggle="modal" data-target="#delivery_detailModal" @click="deliveryNoteDetail(deliveryNoteListIndex)">详情</button>
														</td>
													</template>
													<template v-else><td></td></template>
												</tr>
											</template>
											<template v-else>
												<tr style="text-align: center;">
					                                <td colspan="7" class="no_date" style="line-height: 10rem">{:lang('no_data')} </td>
					                            </tr>	
											</template>
											
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>

					<!-- 配货信息 -->
					<div class="tab-pane" id="making" v-if="saleList.underwrite == 0">
						<div class="row">
						
							<div class="col-md-3">
								<div class="panel panel-default">
									<div class="panel-heading">
										配货信息
									</div>
									<table class="table table-hover">
										<tbody>
											<tr>
												<td>订单状态</td>
												<td>
													<span v-if="saleMakeDetail.status == 1" class="text-danger">确认中</span> 
													<span v-if="saleMakeDetail.status == 2">定金</span> 
													<span v-if="saleMakeDetail.status == 3">排队中</span> 
													<span v-if="saleMakeDetail.status == 4">配货中</span> 
													<span v-if="saleMakeDetail.status == 5">待付款</span> 
													<span v-if="saleMakeDetail.status == 6">待发货</span> 
													<span v-if="saleMakeDetail.status == 7">送货中</span> 
													<span v-if="saleMakeDetail.status == 8">已送货</span> 
													<span v-if="saleMakeDetail.status == 9">完成</span> 
												</td>
											</tr>
											<tr>
												<td>配货主管</td>
												<td>{{saleMakeDetail.saleMakeName}}</td>
											</tr>
											<tr>
												<td>打印</td>
												<td>{{saleMakeDetail.print_count ? saleMakeDetail.print_count + ' / ' + saleMakeDetail.checkerTime : '-'}}</td>
											</tr>
											<tr>
												<td>对货员</td>
												<td>{{saleMakeDetail.checkerName ? saleMakeDetail.checkerName + ' / ' + saleMakeDetail.checkerTime : '-'}}</td>
											</tr>
											<tr>
												<td>仓管员</td>
												<td>{{saleMakeDetail.pickupName ? saleMakeDetail.pickupName + ' / ' + saleMakeDetail.pickupTime : '-'}}</td>
											</tr>
											<tr>
												<td>包装主管</td>
												<td>{{saleMakeDetail.processName ? saleMakeDetail.processName + ' / ' + saleMakeDetail.processTime: '-'}}</td>
											</tr>
											<tr>
												<td>装箱员</td>
												<td>{{saleMakeDetail.packName ? saleMakeDetail.packName + ' / ' + saleMakeDetail.packTime: '-'}}</td>
											</tr>
											<tr>
												<td>开票</td>
												<td>{{saleMakeDetail.invoiceName ? saleMakeDetail.invoiceName + ' / ' + saleMakeDetail.invoiceTime: '-'}}</td>
											</tr>
											<tr>
												<td>银行单</td>
												<td>{{saleMakeDetail.billName ? saleMakeDetail.billName + ' / ' + saleMakeDetail.billTime: '-'}}</td>
											</tr>
											<tr>
												<td>物流主管</td>
												<td>{{saleMakeDetail.make_deliveryName ? saleMakeDetail.make_deliveryName + ' / ' + saleMakeDetail.make_deliveryTime: '-'}}</td>
											</tr>
											<!-- <tr>
												<td>呼叫</td>
												<td>同一个销售单可以分多个物流单</td>
											</tr> -->
											<tr>
												<td>回执</td>
												<td>{{saleMakeDetail.isreceipt}}</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
							
							<div class="col-md-9">
								<div class="panel panel-default">
									<div class="panel-heading">
										装箱单
									</div>
									<table class="table table-hover table-striped">
										<thead>
											<tr>
												<th>箱号</th>
												<th>箱数</th>
												<th>产品</th>
												<th>箱规</th>
												<th>数量</th>
												<th>体积</th>
												<th>重量</th>
												<th>编辑</th>
											</tr>
										</thead>
										<tbody>
											<template v-if="saleMakeDetail.salePackData != undefined && saleMakeDetail.salePackData.length > 0">
											<template v-for="(salePackItem,salePackIndex) in saleMakeDetail.salePackData">
												<tr v-for="(dataItem,dataIndex) in salePackItem.data">
													<template v-if="salePackIndex == 0">
														<td align="center">{{dataIndex+1}}</td>
														<td align="right">{{salePackItem.ctns}}<small class="unit">CTN</small></td>	
													</template>
													<template v-else>
														<td></td>
														<td></td>
													</template>
													<td>
														<div class="pro">
															<div class="pro-icon"><img :src="dataItem.img_url" border="0" width="48px" height="48px" alt="ICON"></div>
															<div class="pro-name">
																<small>{{formatUnit(dataItem.prochar_id,'id') + (dataItem.brand_name ? ' / ' + dataItem.brand_name : '') + (dataItem.model ? ' / ' + dataItem.model :'') }}</small><br>
																{{dataItem.pro_name}}
															</div>
														</div>
													</td>
													<td align="right">
														{{dataItem.prochar_qty}}<small class="unit">PCS/CTN</small><br>
														{{dataItem.ctn_size}}<small class="unit">CM</small>
													</td>
													<td align="right">{{dataItem.qty}}<small class="unit">PCS</small></td>
													<template v-if="dataIndex == 0">
														<td align="right">{{salePackItem.volume*salePackItem.ctns}}<small class="unit">CBM</small></td>
														<td align="right">{{salePackItem.kgs*salePackItem.ctns}}<small class="unit">KGS</small></td>
														<td>{{salePackItem.updatename}}<br>{{salePackItem.update_date}}</td>
													</template>
													<template v-else>
														<td></td>
														<td></td>
														<td></td>
													</template>
												</tr>
											</template>
											</template>
											<template v-else>
												<tr style="text-align: center;" >
					                                <td colspan="8" class="no_date" style="line-height: 10rem">{:lang('no_data')} </td>
					                            </tr>
											</template>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="8" align="right">
													合计箱数: {{formatUnit(packSum[0],'CTN')}}<small class="unit">CTN</small> /
													体积: {{formatUnit(packSum[1],'CBM')}} <small class="unit">CBM</small> /
													重量: {{formatUnit(packSum[2],'KGS')}}<small class="unit">KGS</small>
												</td>
											</tr>
										</tfoot>
									</table>
								</div>
								
								
							</div>
						</div>
					</div>

					<!-- 订单记录 -->
					<div class="tab-pane" id="log">
						<div class="row">
							<div class="col-md-12">
								<table class="table table-striped ntTable">
									<thead>
										<tr>
											<th>时间</th>
											<th>订单进度</th>
											<th>编辑</th>
										</tr>
									</thead>
									<tbody>
										<tr v-for="(saleLogItem,saleLogIndex) in saleLog">
											<td>{{saleLogItem.create_time}}</td>
											<td>{{saleLogItem.remark}}</td>
											<td>{{saleLogItem.create_name}}</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
		  	</div>
		</div>

		<!-- 送货单 -->
		<div class="modal fade" id="delivery_detailModal" tabindex="-1" role="dialog" aria-hidden="true">
		    <div class="modal-dialog modal-lg" style="width:70vw">
		        <div class="modal-content">
		            <div class="modal-header">
		                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		                <h4 class="modal-title">送货单详情</h4>
		            </div>
		            <div class="modal-body">
						<div class="row">
							<div class="col-md-4">
								<div class="panel panel-default">
									<table class="table">
										<tbody>
											<tr>
												<td>销售单</td>
												<td>
													{{ formatUnit(deliveryNoteDetailData.sale_id,'id') }}
													<span class="label label-primary pull-right">{{deliveryNoteDetailData.priority}}</span>
												</td>
											</tr>
											<tr>
												<td>送货类型</td>
												<td>{{deliveryNoteDetailData.delivery_type_name}}</td>
											</tr>
											<tr>
												<td>发票类型</td>
												<td>{{deliveryNoteDetailData.sale_invoice_code}}</td>
											</tr>
											<tr>
												<td>送货单</td>
												<td>
													{{formatUnit(deliveryNoteDetailData.id,'id')}}
													<span class="label label-primary pull-right">{{deliveryNoteDetailData.priority}}</span>
												</td>
											</tr>
											<tr>
												<td>状态</td>
												<td>配货中...</td>
											</tr>
											<tr>
												<td>创建</td>
												<td>{{deliveryNoteDetailData.create_name + (deliveryNoteDetailData.create_time ? ' / ' + deliveryNoteDetailData.create_time : '')}}</td>
											</tr>
											<tr>
												<td>编辑</td>
												<td>{{deliveryNoteDetailData.update_name + (deliveryNoteDetailData.update_time ? ' / ' + deliveryNoteDetailData.update_time : '')}}</td>
											</tr>
											<tr>
												<td>备注</td>
												<td>{{deliveryNoteDetailData.remark}}</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
							<div class="col-md-8">
								<ul class="nav nav-tabs" style="margin-bottom: 0.5rem">
									<li class="active"><a href="#detail" data-toggle="tab">送货内容</a></li>
									<li><a href="#pack" data-toggle="tab">装箱单</a></li>
									<li><a href="#make" data-toggle="tab">配货/送货</a></li>
								</ul>
								<div class="row" >
									<div class="col-md-12 div-scroll tab-content" style="max-height: 60vh">
									
										<div class="panel panel-default tab-pane active" id="detail" >
											<table class="table table-hover">
												<thead>
													<tr>
														<th>No.</th>
														<th>产品</th>
														<th>箱规</th>
														<th>数量</th>
														<th>备注</th>
													</tr>
												</thead>
												<tbody>
													<template  v-if="deliveryNoteDetailData.detail != undefined && deliveryNoteDetailData.detail.length > 0">
														<tr v-for="(detailItem,detailIndex) in deliveryNoteDetailData.detail">
															<td align="center">{{ detailIndex+1 }}</td>
															<td>
																<div class="pro">
																	<div class="pro-icon">
																		<img :src="detailItem.proInfo.img_url" border="0" width="48px" height="48px">
																	</div>
																	<div class="pro-name">
																		<small>{{ formatUnit(detailItem.proInfo.prochar_id,'id') + (detailItem.proInfo.brand_name ? ' / ' + detailItem.proInfo.brand_name : '') + (detailItem.proInfo.model ? ' / ' + detailItem.proInfo.model : '') }}</small> <br />{{detailItem.proInfo.pro_name}}
																	</div>
																</div>
															</td>
															<td align="right">
																{{formatUnit(detailItem.proInfo.prochar_qty,'PCS')}}<small class="unit">PCS/CTN</small><br>
																{{detailItem.proInfo.ctn_size}}<small class="unit">CM</small>
															</td>
															<td align="right">{{ formatUnit( detailItem.qty,'PCS') }}<small class="unit">PCS</small></td>
															<td align="right">
																<button class="btn btn-sm btn-default" data-toggle="popover" title="送货备注"  @mouseover="setpopper">
																	备注
																	<div class="content" style="display: none;">
																		<div style="width:30vw">
																			{{detailItem.remark}}
																		</div>
																	</div>
																</button>
															</td>
														</tr>
													</template>
													<template v-else>
														<tr style="text-align: center;">
							                                <td colspan="5" class="no_date" style="line-height: 20rem">{:lang('no_data')} </td>
							                            </tr>	
													</template>
													
												</tbody>
											</table>
										</div>
										<!-- 装箱单 -->
										<div class="panel panel-default tab-pane" id="pack">
											<table class="table table-hover table-striped">
												<thead>
													<tr>
														<th>箱号</th>
														<th>箱数</th>
														<th>产品</th>
														<th>箱规</th>
														<th>数量</th>
														<th>体积</th>
														<th>重量</th>
														<th>编辑</th>
													</tr>
												</thead>
												<tbody>
													<template v-if="deliveryNoteDetailData.salePackData != undefined && deliveryNoteDetailData.salePackData.length > 0">
													<template v-for="(salePackDataItem,salePackDataIndex) in deliveryNoteDetailData.salePackData">
														<tr v-for="(dataItem,dataIndex) in salePackDataItem.data">
															<template v-if="dataIndex == 0">
																<td align="center">{{dataIndex+1}}</td>
																<td align="right">{{salePackDataItem.ctns}}<small class="unit">CTN</small></td>	
															</template>
															<template v-else>
																<td></td>
																<td></td>
															</template>
															<td>
																<div class="pro">
																	<div class="pro-icon"><img :src="dataItem.img_url" border="0" width="48px" height="48px" alt="ICON"></div>
																	<div class="pro-name">
																		<small>{{formatUnit(dataItem.prochar_id,'id') + (dataItem.brand_name ? ' / ' + dataItem.brand_name : '') + (dataItem.model ? ' / ' + dataItem.model :'') }}</small><br>
																		{{dataItem.pro_name}}
																	</div>
																</div>
															</td>
															<td align="right">
																{{dataItem.prochar_qty}}<small class="unit">PCS/CTN</small><br>
																{{dataItem.ctn_size}}<small class="unit">CM</small>
															</td>
															<td align="right">{{dataItem.qty}}<small class="unit">PCS</small></td>
															<template v-if="dataIndex == 0">
																<td align="right">{{salePackDataItem.volume*salePackDataItem.ctns}}<small class="unit">CBM</small></td>
																<td align="right">{{salePackDataItem.kgs*salePackDataItem.ctns}}<small class="unit">KGS</small></td>
																<td>{{salePackDataItem.updatename}}<br>{{salePackDataItem.update_date}}</td>
															</template>
															<template v-else>
																<td></td>
																<td></td>
																<td></td>
															</template>
														</tr>	
													</template>
													</template>
													<template v-else>
														<tr style="text-align: center;" >
							                                <td colspan="8" class="no_date" style="line-height: 10rem">{:lang('no_data')} </td>
							                            </tr>
													</template>
												</tbody>
												<tfoot  v-if="deliveryNoteDetailData.salePackData != undefined && deliveryNoteDetailData.salePackData.length >0">
													<tr>
														<td colspan="8" align="right">
															合计箱数: {{formatUnit(sumnum[0],'CTN')}}<small class="unit">CTN</small> /
															体积: {{formatUnit(sumnum[1],'CBM')}} <small class="unit">CBM</small> /
															重量: {{formatUnit(sumnum[2],'KGS')}}<small class="unit">KGS</small>
														</td>
													</tr>
												</tfoot>
											</table>
										</div>
										
										<div class="panel panel-default tab-pane" id="make">
											<table class="table table-hover">
												<tbody>
													<tr>
														<td>配货主管{{sale_id}}</td>
														<td>JORDAN</td>
													</tr>
													<tr>
														<td>打印</td>
														<td>1 / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>对货员</td>
														<td>MIKAILANKINO / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>仓管员</td>
														<td>ANLISANDA / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>包装主管</td>
														<td>MANKIA / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>装箱员</td>
														<td>SAMLOFU / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>开票</td>
														<td>JACICKA / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>银行单</td>
														<td>SEINDI / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>物流主管</td>
														<td>KESILI / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>送货员</td>
														<td>AA / BB / CC</td>
													</tr>
													<tr>
														<td>呼叫</td>
														<td>KESILI / 20-02-2020 11:22:33</td>
													</tr>
													<tr>
														<td>回执</td>
														<td>TIM / 20-02-2020 11:22:33</td>
													</tr>
												</tbody>
											</table>
										</div>
									</div>
								</div>
							</div>
						</div>
		            </div>
		            <div class="modal-footer">
		                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span>取消</button>
		            </div>
		        </div>
		    </div>
		</div>
	</div>
</div>
<script src="/static/Admin/js/salecheckdetail.js"></script>
{include file="public/foot"/}